/**
	License:		Artistic license 2.0 (see license.txt, also available online at http://www.perlfoundation.org/artistic_license_2_0)
	Authors:		OrbitalLab (http://www.orbitallab.ru/moonglide/), 2007-2009

	File:			IRendererRes.d
	Description:	interface of resource uploader for rendering subsystem
	Date:			23.11.2007 by Digited
*/
module moonglide.renderer.IRendererRes;

public import moonglide.resources.Management;

//================================================================
/// Shader work
//================================================================
interface IShaderProvider
{
	bool Upload	( inout CResShaderComposite sh );
	bool Unload	( inout CResShaderComposite sh );
	void Bind		( inout CResShaderComposite sh );
	bool Link		( inout CResShaderComposite sh );
	void Unbind	( inout CResShaderComposite sh );
	bool Analyze	( inout CResShaderComposite sh );

	void Enable();
	void Disable();

	void SetLocal	( inout SShaderLoc lo, ubyte shType );
	void SetEnv	( inout SShaderLoc lo, ubyte shType );
}

//=============================================================
/// subj
//=============================================================
interface IShaderManager
{
	void RegisterProvider	( ubyte shType, IShaderProvider shProv );
	bool LoadShader			( inout CResShaderComposite sh );
	bool UnloadShader		( inout CResShaderComposite sh );
	bool LinkShader			( inout CResShaderComposite sh );
	void BindShader			( inout CResShaderComposite sh );
	void UnBindShader		( inout CResShaderComposite sh );
}

//================================================================
/// Renderer & Resources load. Must listen to resmanager to get resource events
//================================================================
interface IRendererRes
{
	protected:
		void _upLoadMesh	( CResMesh		mesh );
		bool _upLoadShader	( CResShaderComposite	sh );
		void _upLoadMaterial( CResMaterial	mat );

		void _unLoadMesh	( CResMesh	 	mesh );
		bool _unLoadShader	( CResShaderComposite	sh );
		void _unLoadMaterial( CResMaterial	mat );

	public:

		IShaderManager shaderMan();

		void upLoadTexture	( CResTexture	tex );
		void unLoadTexture	( CResTexture	tex );

		void upLoadRes( IResource res );
		void unLoadRes( IResource res );
}
